package gold.digger;

/**
 * Created by fanzhenyu02 on 2020/6/27.
 * common problem solver template.
 */
public class LC242 {
    public long startExecuteTime = System.currentTimeMillis();


    public boolean isAnagram(String s, String t) {
        if (s.length() != t.length()) {
            return false;
        }

        int[] dict = new int[26];
        for (int i = 0; i < s.length(); i++) {
            dict[s.charAt(i) - 'a']++;
            dict[t.charAt(i) - 'a']--;
        }

        for (int i = 0; i < 26; i++) {
            if (dict[i] != 0) {
                return false;
            }
        }

        return true;
    }


    public static void main(String[] args) {
        LC242 an = new LC242();
        System.out.println(an.isAnagram("", ""));

        System.out.println("\nanswer total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
